package com.micro.modual.controller;

import com.micro.core.resp.RespJson;
import com.micro.core.resp.RespJsonData;
import com.micro.core.resp.RespJsonPageData;
import com.micro.modual.model.bo.orderconfig.OrderConfigBO;
import com.micro.modual.model.dto.orderconfig.OrderConfigDetailDTO;
import com.micro.modual.model.dto.orderconfig.OrderConfigListDTO;
import com.micro.modual.service.OrderConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*;

import java.util.Map;

/**
 * <h1>订单配置表 控制器</h1>
 * @author levelcoder
 * @version V1.0.0
 * @email LevelCoder@126.com
 * @date 2020-08-04 00:27:47
 */
@Api(value = "订单配置管理",tags = "订单配置管理")
@RestController
@RequestMapping(value = "orderConfig")
public class OrderConfigController {

    @Autowired
    private OrderConfigService orderConfigService;

    /**
     * <h2>查找订单配置表 列表</h2>
     * @param params 列表查询请求对象
     * @return List<OrderConfigListDTO> {@link OrderConfigListDTO}s  订单配置表 列表返回对象
     */
    @ApiOperation(value = "查询订单配置表列表" ,notes = "查询订单配置表列表")
    @GetMapping(value = "/findOrderConfigList")
    public RespJsonPageData<OrderConfigListDTO> findOrderConfigList(@RequestParam  Map<String,Object> params){
        return orderConfigService.findList(params,OrderConfigListDTO.class);
    }

    /**
     * <h2>根据主键编号查看订单配置表详情</h2>
     * @param id  订单配置表 主键编号
     * @return {@link OrderConfigDetailDTO}  订单配置表 详情
     */
    @ApiOperation(value = "查询订单配置表详情",notes = "根据主键编号，查询订单配置表详情")
    @GetMapping(value = "/findOrderConfigDetail/{id}")
    public RespJsonData<OrderConfigDetailDTO> findOrderConfigDetail(@PathVariable("id") Long id){
        return orderConfigService.findDetail(id,OrderConfigDetailDTO.class);
    }

    /**
     * <h2>新增订单配置表详情</h2>
     * @param orderConfigBO {@link OrderConfigBO} 订单配置表 新增/修改 请求对象
     * @return {@link RespJson} 返回结果基础类
     */
    @ApiOperation(value = "新增订单配置表",notes = "新增订单配置表")
    @PostMapping(value = "/addOrderConfig")
    public RespJson addOrderConfig(@RequestBody OrderConfigBO orderConfigBO){
        return orderConfigService.addOrderConfig(orderConfigBO);
    }

    /**
     * <h2>修改订单配置表详情</h2>
     * @param orderConfigBO  {@link OrderConfigBO} 订单配置表 新增/修改 请求对象
     * @return {@link RespJson} 返回结果基础类
     */
    @ApiOperation(value = "修改订单配置表",notes = "修改订单配置表")
    @PostMapping(value = "/editOrderConfig")
    public RespJson editOrderConfig(@RequestBody OrderConfigBO orderConfigBO){
        return orderConfigService.editOrderConfig(orderConfigBO);
    }

    /**
     * <h2>根据主键编号删除订单配置表信息</h2>
     * @param id  订单配置表 主键编号
     * @return  {@link RespJson} 返回结果基础类
     */
    @ApiOperation(value = "删除订单配置表",notes = "根据地址ID，删除订单配置表")
    @PostMapping(value = "/deleteOrderConfig/{id}")
    public RespJson deleteOrderConfig(@PathVariable("id") Long id){
        return orderConfigService.deleteOrderConfig(id);
    }
}

